package com.lizk.shiro.lesson2;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.SimpleAuthenticationInfo;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.realm.jdbc.JdbcRealm;
import org.apache.shiro.subject.PrincipalCollection;

public class MyJdbcRealm extends JdbcRealm{
/*
	@Override
	protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
		UsernamePasswordToken upToken = (UsernamePasswordToken) token;
		return new SimpleAuthenticationInfo( upToken.getUsername(),upToken.getPassword(), getName());
	}

	@Override
	protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
		
		Set<String> set = new HashSet<>(); 
		set.add("aaa");
		
		
		Set<String> set2 = new HashSet<>(); 
		set2.add("sss");
		
		SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(set);
		info.setStringPermissions(set2);
		
		return info;
	}
*/
	
	
	
	
}
